package com.lanxin.shiro.config;


import com.lanxin.vo.ResponseBean;
import org.apache.shiro.authz.UnauthorizedException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

@ControllerAdvice
public class GlobalDefaultExceptionHandler {


    @ExceptionHandler(UnauthorizedException.class)
    @ResponseBody
    public ResponseBean defaultExceptionHandler(HttpServletRequest req, Exception e) {

        return new ResponseBean(500, "未授权");
    }
}